package org.example.controller;


import org.example.config.ThreadConfig;
import org.example.entity.SysLogs;
import org.example.service.ISysLogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zhaowenting
 * @since 2024-03-26
 */
@RestController
@RequestMapping("/sys-logs")
public class SysLogsController {
    @Autowired
    ISysLogsService iSysLogsService;
    @Autowired
    private ThreadConfig asyncServiceExecutor;

    /**
     * 日志列表
     * @return
     */
    @RequestMapping("sysLogList")
    public List<SysLogs> sysLogList(){

        List<SysLogs> list = iSysLogsService.list();
        return list;
    }

    /**
     * 删除日志表里的数据
     * 根据id删除
     * @param ids
     * @return
     */
    @RequestMapping("delLogs")
    public String delLogs(Integer[] ids){
        System.out.println("前端传过来的数据：==="+ids);
        System.out.println(ids.length);
        for (Integer id : ids) {
            iSysLogsService.removeById(id);
        }
        return "success";
    }




}
